#
# Makefile
#
# libevent Python bindings
#
# Copyright (c) 2010 Elizabeth Jennifer Myers <elizabeth@sporksirc.net>
# Copyright (c) 2004 Dug Song <dugsong@monkey.org>
# Copyright (c) 2003 Martin Murray <murrayma@citi.umich.edu>
#

PYTHON ?= python

PYREXC ?= cython

PKGDIR	= pyevent-`egrep version setup.py | cut -f2 -d"'"`

all: event.c
	$(PYTHON) setup.py config $(CONFIG_ARGS)
	$(PYTHON) setup.py build

event.c: event.pyx bufferevent.pxi evdns.pxi evhttp.pxi simple.pxi
	$(PYREXC) event.pyx

install:
	$(PYTHON) setup.py install

test:
	$(PYTHON) test.py

pkg_win32:
	$(PYTHON) setup.py bdist_wininst

pkg_osx:
	bdist_mpkg --readme=README --license=LICENSE
	mv dist $(PKGDIR)
	hdiutil create -srcfolder $(PKGDIR) $(PKGDIR).dmg
	mv $(PKGDIR) dist

clean:
	$(PYTHON) setup.py clean
	rm -rf build dist

cleandir distclean: clean
	$(PYTHON) setup.py clean -a
	rm -f *.c *~
